<%@ page language="java" contentType="text/html;charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="include/head.jsp" %>
<%@ include file="include/menu_search.jsp" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
</style>


</head>
<body>
	
	<div style="position: absolute; right: 0px; ">
		<div style="padding:0 100px;"><a>首页</a>&nbsp > &nbsp购物车</div>		

	</div>
	
	
	<div style="margin:0 40px; padding:20px;border:1px soulid;">
		<%
		String book[][]= new String[4][4];
		book[0] = (String[]) session.getAttribute("book0");
		book[1] = (String[]) session.getAttribute("book1");
		book[2] = (String[]) session.getAttribute("book2");
		book[3] = (String[]) session.getAttribute("book3");
		
		out.println("<form>");
		out.println("<div style='background-color:rgb(225, 255, 225)'>");
		out.println("<table width='100%' border='0' cellspacing='0'>");
		out.println("<tr><td width='13%'>"+"序号"+"</td><td width='21%'>"+"商品名称"+"</td>");
		out.println("<td width='13%'>价格</td>");
		out.println("<td width='10%'>库存</td>");
		out.println("<td width='20%'>数量</td>");
		out.println("<td width='20%'>删除</td>");
		out.println("<td width='10%'><nbsp></td></tr>");
		out.println("</table>");
		out.println("</div>");
		out.println("</form>");
		
		double price=0;
		int j=1;
		for(int i=0;i<4;i++){
			if(book[i]!=null){
				out.println("<form action='DeleteCart.jsp?i="+i+"' method='post'>");
				out.println("<div style='background-color:rgb(252, 253, 239);'  id='div"+i+"'>");
				out.println("<table width='100%' border='0' cellspacing='0'>");
				out.println("<tr><td width='13%'>"+j+"</td><td width='21%'>"+book[i][0]+"</td>");
				out.println("<td width='13%'>"+book[i][1]+"</td>");
				out.println("<td width='10%'>"+book[i][2]+"</td>");
				out.println("<td width='20%'>"+book[i][3]+"</td>");
				out.println("<td width='20%'><input  type='submit' value='X' style='color:#FF0000;font-weight:bold' '></input></td>");
				out.println("<td width='10%'></td></tr>");
				out.println("</table>");
				out.println("</div>");
				out.println("</form>");
				price += Double.parseDouble(book[i][1]);
				j++;
			}
			
		}
		

		
		out.println("<form>");
		out.println("<div style='background-color:rgb(225, 255, 225); color:rgb(245, 158, 109)'>");
		out.println("<table width='100%' border='0' cellspacing='0' style='text-align:right;'>");
		out.println("<td width='100%'>合计："+price+"元</td></tr>");
		out.println("</table>");
		out.println("</div>");
		out.println("</form>");
		
	%>


</div>
	

</body>

<%@ include file="include/foot.jsp" %>

</html>